<!doctype html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-model="http://www.w3.org/1999/xhtml" xmlns:v-demo="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .router-link-active {
            color:#f00;
        }
        pre {
            font-family: sans-serif;
            font-size: 1em;
            line-height:1.5em;
        }

    </style>
</head>
<body>
    <div id="app">
        <todos :todos="todos"></todos>
    </div>
</body>

<script src="../../vender/vue@2.4.2.js"></script>
<script src="../../vender/vuex@2.0.0.min.js"></script>
<!--<script src="../vue-router@2.7.0.js"></script>-->

<script>
    const Todos={
        template:`<div>
        <ul>
            <li v-for="todo of todos">{{todo}}</li>
        </ul>

        doneTodos:
        <ul>
            <li v-for="todo of doneTodos">{{todo}}</li>
        </ul>

        doneTodosCount:{{doneTodosCount}}
       </div>`,
        props:['todos'],
        computed:{
            doneTodos(){
                return this.todos.filter(todo=>todo.done);
            },
            doneTodosCount(){
                return this.doneTodos.length;
            }
        }
    };
//52200
//24200
//74300
    new Vue({
        el:'#app',
        data:{
            todos:[
                {id:0,text:'todo-0',done:true},
                {id:1,text:'todo-1',done:false},
                {id:2,text:'todo-2',done:true},
                {id:3,text:'todo-3',done:false}
            ]
        },
        components:{
            Todos
        }
    });

</script>
</html>